home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / grphwiz.dxr / 00067_check autorange button.ls < prev    next >
Encoding:
Text File  |  2000-01-14  |  1.9 KB  |  59 lines

  1. property ancestor, pMIAW
  2. global gEnvironObj, gOKAlert, gGraphHelp, gGraph, gGraphWizard
  3.  
  4. on new me, buttonName, castName, theChannel, theStageLoc, descendant
  5.   if objectp(descendant) then
  6.     ancestor = new(script("generic button"), buttonName, castName, theChannel, theStageLoc, descendant)
  7.   else
  8.     ancestor = new(script("generic button"), buttonName, castName, theChannel, theStageLoc, me)
  9.   end if
  10.   return me
  11. end
  12.  
  13. on setMIAW me, miaw
  14.   pMIAW = miaw
  15.   return me
  16. end
  17.  
  18. on performFunction me
  19.   if not getaProp(gGraph, #pIsAutoRange) then
  20.     oldDelimiter = the itemDelimiter
  21.     the itemDelimiter = RETURN
  22.     loStr = stripCommas(item 1 of the text of field "low field")
  23.     hiStr = stripCommas(item 1 of the text of field "high field")
  24.     the itemDelimiter = oldDelimiter
  25.     if not ((loStr = EMPTY) or (loStr = " ") or (hiStr = EMPTY) or (hiStr = " ")) then
  26.       min = value(loStr)
  27.       max = value(hiStr)
  28.     end if
  29.     if voidp(min) or voidp(max) then
  30.       tell the stage
  31.         openAlertWindow("okalert", rect(0, 0, 320, 171), "Invalid values were entered for the y-axis range. Enter numbers for the highest and lowest y-values or choose computer generated y-axis range.")
  32.       end tell
  33.     else
  34.       if min >= max then
  35.         tell the stage
  36.           openAlertWindow("okalert", rect(0, 0, 320, 171), "The highest value must be larger than the lowest value.")
  37.         end tell
  38.       else
  39.         setaProp(gGraph, #pIsConsistant, 0)
  40.         setaProp(gGraph, #pMin, min)
  41.         setaProp(gGraph, #pMax, max)
  42.         setIntervalList(gGraphWizard, getIntervalList(gGraph))
  43.         if windowPresent("Graph Help") then
  44.           closeMe(gGraphHelp)
  45.         end if
  46.         outScope(pMIAW)
  47.         go(getNextPage(pMIAW))
  48.       end if
  49.     end if
  50.   else
  51.     if windowPresent("Graph Help") then
  52.       closeMe(gGraphHelp)
  53.     end if
  54.     outScope(pMIAW)
  55.     go(getNextPage(pMIAW))
  56.   end if
  57.   return me
  58. end
  59.